package com.nacrtstudio.webgiftshop.pages.admin;

import org.apache.shiro.authz.annotation.RequiresRoles;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.ioc.annotations.Inject;

import com.nacrtstudio.webgiftshop.facade.Controller;
import com.nacrtstudio.webgiftshop.model.shop.Gift;

@RequiresRoles("admin")
public class EditGift {
	@Inject
	private Controller controller;
	@Persist
	private Gift editGift;
	
	public Gift getEditGift() {
		return editGift;
	}
	public void setEditGift(Gift editGift) {
		this.editGift = editGift;
	}
	
	Object onSuccess() {
		controller.updateGift(editGift);
		return Catalog.class;
	}
}
